﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class InteractableObject : MonoBehaviour
{
    public Mainmenu Loading; // 指向主菜单脚本的引用

    private void Update()
    {
        // 检查玩家是否按下了E键
        if (Input.GetKeyDown(KeyCode.E))
        {
            // 调用主菜单脚本的Loadlevel方法，传入要加载的场景索引
            if (Loading != null)
            {
                Loading.Loadlevel(SceneManager.GetActiveScene().buildIndex + 1);
            }
        }
    }

}
